<?php

namespace App\Http\Requests\Recommend;

use Illuminate\Foundation\Http\FormRequest;

class Reclist0Request extends FormRequest
{

    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        switch ($this->method()) {
            case 'GET':
            case 'DELETE':
                {
                    return [];
                }
            // Crate
            case 'POST':
                {
                    return [
                        'name'      => 'required',
                        'reccat_id' => 'required',
                        'tpl_id'    => 'required',
                    ];
                }
            // UPDATE
            case 'PUT':
            case 'PATCH':
                {
                    $id = $this->route('reclist0s');
                    return [
                        'name'      => 'required',
                        'reccat_id' => 'required',
                        'tpl_id'    => 'required',

                    ];
                }
            default:
                break;
        }
    }
}
